package mvpfoot.presenter;

import android.util.Log;



import java.io.File;
import java.util.ArrayList;
import java.util.logging.LogManager;

import mvpfoot.entity.Stores;
import mvpfoot.entity.ZhiHuDaily;
import mvpfoot.entity.ZhihuStory;
import mvpfoot.ui.PersonCenterActivity;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;

/**
 * Created by Chen qin lang on 2017/1/11.
 */
public class DownLoadPresenter extends BasePresenter {
    private static final String TAG = "this";
    public PersonCenterActivity personCenterActivity;

    public DownLoadPresenter(PersonCenterActivity personCenterActivity) {
        this.personCenterActivity = personCenterActivity;
    }
    public void loadNetworkInfo() {
        Call<ZhiHuDaily> infocall = networkApi.getInfo();
        infocall.enqueue(new MyCallBack());
    }

    @Override
    public void pareseData(Response<ZhiHuDaily> response){
        ZhiHuDaily body = response.body();

        ArrayList<ZhihuStory> stories = body.getStories();
        personCenterActivity.LoadSuccess(stories);
        Log.d(TAG, "pareseData() called with: " + "response = [" + body.getStories().get(0) + "]"+"asdfasdfasf"+  response.raw().headers());
    }

    @Override
    public void showError() {
        Log.d(TAG, "showError() called with: " + "");
    }


   /* public void upload(String fileName) {
        String str= FileUtil.loadFromAssets(personCenterActivity.getApplicationContext(),"novate.png");
        String url="";
        RequestBody requestFile= RequestBody.create(MediaType.parse("image/png"),str);

        Call<ResponseBody> responseBodyCall = networkApi.upload(url,requestFile);
        responseBodyCall.enqueue(new MyCallBack());
    }
    public  void download(String url){

    }*/
}
